import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/salesOrderDetail/addOrSave',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/salesOrderDetail/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/salesOrderDetail/addOrSave',
    method: 'put',
    data
  })
}

export function getSaleOrderDetail(params) {
  return request({
    url: 'api/salesOrder/detail',
    method: 'get',
    params
  })
}

/**
 * 查询销售单历史记录
 * @param params
 * @returns {AxiosPromise}
 */
export function getSaleOrderHistoryDetail(params) {
  return request({
    url: 'api/salesOrder/history',
    method: 'get',
    params
  })
}

export function split(data) {
  return request({
    url: '/api/salesOrder/split',
    method: 'post',
    data
  })
}

export default { add, edit, del, getSaleOrderDetail, getSaleOrderHistoryDetail }
